<section id="trainer-profile">
    <div class="row">
        <div class="container">
            <div class="col-lg-12 column12">
                <div id="bread">
                    <ol class="breadcrumb">
                        <li><a href="<?php echo SITE_URL; ?>">Home</a></li>
                        <li><?php echo CHtml::link($classCoursename, $this->createAbsoluteUrl($action)); ?></li>
                        <li class="active"><?php echo $profiles->first_name . ' ' . $profiles->last_name; ?></li>
                    </ol>
                </div><!-- breadcrumb div ends here --> 
            </div>  
            <div class="column-left col-md-6 col-sm-6 col-xs-12 column6" id="profile-pic">
                <?php $trainerProfileImage = ($profiles->photo != '') ? getRequestbaseUrl() . getuploadFolderDir() . $profiles->user_id . '/profile/432X324/' . $profiles->photo : getWorkNoshopimage(SkillConfig::skill_trainer_profile); ?>
                <figure>
                    <img src="<?php echo $trainerProfileImage; ?>" alt="trainer_profile pic" class="img-responsive">
                </figure>
            </div>
            <div class="column-right col-md-6 col-sm-6 col-xs-12 column6">
                <h1> <?php echo $profiles->first_name . '  ' . $profiles->last_name; ?></h1>
                <p>Member since <?php echo date('d M Y', $profiles->user->createtime); ?></p>
                <hr>
                <ul class="list-unstyled icons">
                    <li class="target"><a href="<?php echo ($userType != 'backend') ? $profiles->facebook : FACEBOOK_LINK; ?>" target="_blank"></a></li>
                    <li class="target"><a href="<?php echo ($userType != 'backend') ? $profiles->twitter : TWITTER_LINK; ?>" target="_blank"></a></li>
                    <li class="target"><a href="<?php echo ($userType != 'backend') ? $profiles->linkedin : LINKEDIN_LINK; ?>" target="_blank"></a></li>

                    <li class="pull-right target">
                        <input type="submit" value="<?php echo $folowers; ?>"  id="submitLbtRFollwers"onclick="followTrainner(<?php echo $classes->id; ?>,<?php echo "'$classtype'" ?>)"/>
                        <span id="followTrainnerloader" style="display: none;"><img src="<?php echo ThemePath(); ?>/images/myskill.gif"></img></span>
                    </li>
                    <li class="pull-right target" style="clear:both;"><span id="error_reviews_text_trainer" class="errorMessage"></span></li>  
                </ul>

                <section class="recomends">
                    <div class="recomend-sec">
                        <div class="container">
                            <div class="recomend-people">
                                <span><?php echo (!empty($classtotalCountTrainerate)) ? $classtotalCountTrainerate . '' : '0'; ?></span>
                                Recommendations
                            </div>
                            <div class="recomend-rating">
                                Rating: <span><?php echo (!empty($classTrainerRate)) ? $classTrainerRate . '% ' : '0 % '; ?></span>Positive
                            </div>
                        </div> 
                    </div>
                </section><!--recomend end here-->
            </div> 

        </div> <!-- trainer-profile container ends here --> 
    </div>       
</section>

<section id="trainer-detail">
    <div class="row">
        <div class="container">
            <div class="col-lg-7 col-md-7 col-sm-7 col-xs-12 column7">
                <div class="tab-header">
                    <ul id="myTab" class="nav nav-tabs">
                        <li class="active"><a href="#about_me" data-toggle="tab">about me</a></li>
                        <li><a href="#experience" data-toggle="tab">experience</a></li>
                        <li><a href="#information" data-toggle="tab">information</a></li>
                    </ul>
                </div>
                <!-- Tab content div -->
                <div id= "myTabContent" class="tab-content">
                    <!-- **********************new tab***************** -->
                    <div class="tab-pane active" id="about_me">
                        <article>
                            <?php echo $profiles->about; ?>
                        </article>
                    </div>

                    <!-- *********************ends************************ -->
                    <div class="tab-pane" id="experience">
                        <article>
                            <?php echo $profiles->experience; ?>
                        </article>
                    </div>
                    <div class="tab-pane " id="information">
                        <article>
                            <?php echo $profiles->other_info; ?>

                        </article>
                    </div>


                </div> 
                <!-- tab content div ends -->

            </div>
            <div class="col-lg-5 col-md-5 col-sm-5 col-xs-12 column5 ">

                <div class="add-review" style="display: none;">
                    <div class="container">
                        <h4>Add review</h4>
                        <hr>
                        <?php /* ---------render page reviewpage for write review start ---------------- */ ?>
                        <?php $this->renderPartial('/trainerProfileReview/_form', array('profiles' => $profiles, 'userType' => $userType)); ?>
                        <?php /* ---------render page reviewpage end---------------- */ ?>
                    </div><!--container-->
                </div>

                <?php /* ---------render page reviewpage for view all  review start ---------------- */ ?>
                <?php $this->renderPartial('/trainerProfileReview/_viewReview', array('profiles' => $profiles, 'userType' => $userType)); ?>
                <?php /* ---------render page reviewpage end---------------- */ ?>
            </div>
        </div><!--trainer detail div ends here-->
    </div><!--row ends here-->
</section>

<?php
$runningClasses = array();
$classDetails = literalEndingTommorow($profiles, $userType, '');
$courseDetails = runningCurrentCoursesByUser($profiles, $userType, ''); //Null parameter means these value $profiles, $userType, $getValue)
$runningClasses = array_merge($classDetails, $courseDetails);
usort($runningClasses, 'date_compare');

if (!empty($runningClasses)) {
    $this->renderPartial('//classes/_runningClassCourseByUser', array('runningClasses' => $runningClasses, 'authKey' => $authKey));
} else {

    $allClassCourseInfo = array();
    $classDetails = getAllliteralEndingTommorowWorkshop('', '', '', LITERAL_ENDING_RENDER_PAGE_LIMIT);
    $courseDetails = getAllliteralEndingTommorowCourses('', '', '', LITERAL_ENDING_RENDER_PAGE_LIMIT); //Null parameter means these value $profiles, $userType, $getValue)
    $allClassCourseInfo = array_merge($classDetails, $courseDetails);
    usort($allClassCourseInfo, 'date_compare');
    if (!empty($allClassCourseInfo)) {
        $this->renderPartial('/classes/literallyEndingtomorrow', array('allClassCourseInfo' => $allClassCourseInfo));
    }
}
?>


<?php /* previousClassCourseByuser */ ?>
<?php
$priviousClasses = previousClassCourseByuser($profiles, $userType);
if (!empty($priviousClasses)) {
    $this->renderPartial('//classes/_previouslytaughtClassesCourses', array('priviousClasses' => $priviousClasses, 'authKey' => $authKey));
}
?>

<?php /* code for slider People who liked this Literally Ending tomorrow */ ?>
<?php
$likeClassCourse = peoplelikedClassCourse();
if (!empty($likeClassCourse)) {
    $this->renderPartial('//classes/_likeClassCourse');
}
?>


<script>       function followTrainner(class_id, type) {
    $("#followTrainnerloader").show();
    $.post("<?php echo Yii::app()->createUrl("TrainerFollow/followTrainner"); ?>", {'YII_CSRF_TOKEN': $('input[name="YII_CSRF_TOKEN"]').val(), 'class_id': class_id, 'type': type}, function(result) {
        $("#followTrainnerloader").hide();
        if ($.trim(result) == 'redirect') {                                    
            window.location = "#top-position";
            $('#login-panel').slideToggle();
            return false;
        }
        if ($.trim(result) == 'Fail') {
            $("#error_reviews_text_trainer").text("You can't follow own.");
            return false;
        }
        if ($.trim(result) == 'againsameuser') {
            $("#error_reviews_text_trainer").text("You you have already follow  <?php echo $profiles->first_name . ' ' . $profiles->last_name; ?>. trainer").show();
            return false;
        }
        if ($.trim(result) == 'success') {                                       
            $('#submitLbtRFollwers').val(<?php echo "'" . Message::FOLOWER_ON_SKILLHIPPO . "'"; ?>);
            $("#error_reviews_text_trainer").text("Now you have follow this trainer name   <?php echo $profiles->first_name . ' ' . $profiles->last_name; ?>. trainer").show();
            return false;
        }
    });
}


</script>
<script type="text/javascript">
$(document).ready(function(e) {
    $("#review-text").click(function() {
        $(".add-review").show();
        $(".trainerProfilereview").hide();
    });
})
</script>  
<script type="text/javascript">
$(document).ready(function(e) {
    $("#review-dismis").click(function() {
        $(".add-review").hide();
        $(".trainerProfilereview").show();
    });
})
</script>